package com.ruoyi.kq.service.impl;

import java.util.Collections;
import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.kq.mapper.WorkRecordMapper;
import com.ruoyi.kq.domain.WorkRecord;
import com.ruoyi.kq.service.IWorkRecordService;

/**
 * kqService业务层处理
 *
 * @author huangdelu
 * @date 2025-03-17
 */
@Service
public class WorkRecordServiceImpl implements IWorkRecordService
{
    @Autowired
    private WorkRecordMapper workRecordMapper;

    /**
     * 查询kq
     *
     * @param id kq主键
     * @return kq
     */
    @Override
    public WorkRecord selectWorkRecordById(String id)
    {
        return workRecordMapper.selectWorkRecordById(id);
    }

    /**
     * 查询kq列表
     *
     * @param workRecord kq
     * @return kq
     */
    @Override
    public List<WorkRecord> selectWorkRecordList(WorkRecord workRecord)
    {
        return workRecordMapper.selectWorkRecordList(workRecord);
    }

    /**
     * 新增kq
     *
     * @param workRecord kq
     * @return 结果
     */
    @Override
    public int insertWorkRecord(WorkRecord workRecord)
    {
        workRecord.setCreateTime(DateUtils.getNowDate());
        return workRecordMapper.insertWorkRecord(workRecord);
    }

    /**
     * 修改kq
     *
     * @param workRecord kq
     * @return 结果
     */
    @Override
    public int updateWorkRecord(WorkRecord workRecord)
    {
        workRecord.setUpdateTime(DateUtils.getNowDate());
        return workRecordMapper.updateWorkRecord(workRecord);
    }

    /**
     * 批量删除kq
     *
     * @param ids 需要删除的kq主键
     * @return 结果
     */
    @Override
    public int deleteWorkRecordByIds(String[] ids)
    {
        return workRecordMapper.deleteWorkRecordByIds(ids);
    }

    /**
     * 删除kq信息
     *
     * @param id kq主键
     * @return 结果
     */
    @Override
    public int deleteWorkRecordById(String id)
    {
        return workRecordMapper.deleteWorkRecordById(id);
    }

    @Override
    public List<WorkRecord> selectWorkRecordByUserIdAndDate(Long userId, String date) {
        return workRecordMapper.selectWorkRecordByUserIdAndDate(userId, date);
    }
}
